User blog:Drake178/Call Chaos Patch
Call Chaos no longer crashes the game when cast by the AI outside of the defender's first turn Call Chaos now uses the correct graphics for Doom Bolt and Fire Bolt Call Chaos no longer freezes all units while playing its animation Call Chaos no longer glitches the graphics when applying its effects Call Chaos now applies its effects with more appropriate timing The Healing animation of Call Chaos is no longer misaligned Common patch file (WIZARDS.EXE, all versions - mind the bold text!): :Call Chaos Patch Text v1.51 reversal file - apply BEFORE the patch in v1.51/RC only (i.e. don't in CoM): :Call Chaos v1.51 reverse CoM reversal and feature file - apply AFTER the patch (which will generate a ton of warnings that can be ignored): :Call Chaos CoM Additionals The patch does not include a fix for the Disintegrate effect dealing random damage when resisted. This is corrected by W177FIX.TXT in the Unofficial Patch 1.50/CoM, but here's an alternative, which saves a jump in comparison: B0414 0F 11 It also does not resolve the Chaos Channels effect considering Torin and already Chaos Channeled units as valid targets. This issue has a fix in Insecticide, and consequently v1.50+ and CoM as well, but for those running v1.31, here's a quick fix for that too: B034B FF 80 B034C 77 7F B034D 30 0B B034E 9A 0F B034F 48 7C B0350 00 14 B0351 C8 E9 B0352 03 D2 B0353 59 00 B0354 0B 00 B0355 C0 00 B0673 31 34 Finally, here's some optional stuff. To use the fire pillar animation of Flame Strike instead of the original Fire Bolt (as Call Chaos confusingly does in v1.31), apply the following patch after everything else: ; Flame Strike instead of Fire Bolt animation AFF12 0B 10 AFF13 0A 0B AFFB1 00 21 B01EF 7F 7D To replace the Warp Creature animation with that of Disrupt to make every effect different, apply this instead. That is, this will not work in combination with the fire pillar above, there is not enough memory for both! It's possible to do that, but it's not trivial, and I didn't see the need to. Sorry about that. ; Disrupt instead of Warp Creature AFF0B 90 BB AFF0C 90 08 AFF0D 90 05 AFF9D EB 90 AFF9E 0D 90 B01F1 7C 74 B01F2 31 06 B01F3 04 3C B01F4 02 03 B01F5 88 74 B01F6 D3 3B B01F7 90 EB B01F8 90 2B B01F9 90 04 B01FA 90 02 B01FB 90 88 B01FC 90 D3 Finally, here's the code and supporting notes: Effect: Index: File: Entry: M_Size: Frames: D_Size: Dmg_F: Confusion: 0 CMBTFX 20 548 8 0 8 Healing: 1 SPECFX 3 5289 12 1 10 C.Channels: 2 SPECFX 2 10229 18 1 w/e Warp Cr: 3 SPECFX 2 - 18 1 15 (Disrupt 3 CMBTFX 1 2283 8 0 6 Fire Bolt: 4 CMBTFX 0 753 (11) spec 11 (Flame Strike 4 CMBTFX 33 4629 16 0 12) Warp L: 5 CMBTFX 3 2115 8 0 7 Doom Bolt: 6 CMBTFX 5 601 (11+4) spec 13 Disintegrate: 7 CMBTFX 4 5260 10 0 9 InitX: InitY: MoveX: MoveY: FinX: FinY: Fire Bolt: X+94 Y-86 -10 6 X-16 Y-20 (+110) (-66) Doom Bolt: X-14 Y-97 0 6 X-14 Y-25 (+0) (-72) typedef struct { char Effect_Index; char Apply_Frame; char First_Frame; char Last_Frame; } CALL_CHAOS; figure table size: 3F2h paragraphs new animation array offset: bp-0x1c effect array offset: bp-0xac $AFE7E: 8b 3e 8e 99 mov di, 0x998e //LBX_Sandbox_Seg 57 push di 9a 22 02 40 00 call LBX_Alloc_Mark() // :1E7F -> :1E66 59 pop cx 68 f2 03 push 0x3f2 57 push di 9a 7c 03 40 00 call LBX_Alloc_Next() // :1E84 -> :1E70 59 pop cx 59 pop cx 33 ff xor di, di 89 7e fc mov bp-4, di //Highest_Frames UNIT_LOOP1: $AFEA0 8b c7 mov ax, di c1 e0 02 shl ax, 2 //sizeof(CALL_CHAOS) 8d b6 54 ff lea si, bp-0xac //Effect_Array 01 c6 add si, ax 8b c7 mov ax, di 6b c0 6e imul ax, 0x6e //sizeof(BU_REC) c4 1e 2a 92 les bx, 0x922a //BU_Table@ 03 d8 add bx, ax 26 8a 47 35 mov al, es:bx+0x35 //.Unit_Owner 98 cbw 3b 46 f8 cmp ax, bp-8 //Casting_Player 75 06 jnz +6 c6 04 ff mov byte ptr si, -1 // no effect e9 .. .. jmp NEXT_UNIT1 // $AFF40 26 80 7f 34 00 cmp es:bx+0x34, 0 //.Status = Active 75 f3 jnz -13 6a 05 push 5 9a d8 00 b0 00 call RNG_Random() // :1F24 -> :1EB2 59 pop cx 48 dec ax 50 push ax 90 nop 6a 08 push 8 9a d8 00 b0 00 call RNG_Random() 59 pop cx 48 dec ax 88 04 mov si, al //.Effect_Index 5a pop dx 88 54 02 mov si+2, dl //.First_Frame 83 7e 08 00 cmp bp+8, 0 //Spell_Anims 75 0b jnz +11 50 push ax 57 push di 90 nop 0e push cs e8 .. .. call near $B02BC //BU_CallChaos() 59 pop cx 59 pop cx eb .. jmp NEXT_UNIT1 // $AFF40 bb 08 07 mov bx, 0x0708 85 c0 test ax, ax 74 27 jz SET bb 0c 09 mov bx, 0x090c 48 dec ax 74 21 jz SET bb 12 0e mov bx, 0x0e12 48 dec ax 74 1b jz SET 90 90 90 nop nop nop // 0x0508 for Disrupt 48 dec ax 74 15 jz SET bb 0b 0a mov bx, 0x0a0b // 0x0b10 for FS 48 dec ax 74 0f jz SET bb 08 06 mov bx, 0x0608 48 dec ax 74 09 jz SET bb 0f 0c mov bx, 0x0c0f 48 dec ax 74 03 jz SET bb 0a 08 mov bx, 0x080a SET: 3a 5e fc cmp bl, bp-4 7e 03 jle +3 88 5e fc mov bp-4, bl 00 d3 add bl, dl fe cb dec bl 00 d7 add bh, dl 88 7c 01 mov si+1, bh //.Apply_Frame 88 5c 03 mov si+3, bl //.Last_Frame NEXT_UNIT1: $AFF40 47 inc di 3b 3e 88 c5 cmp di, 0x88c5 //BU_Count 0f 8c .. .. jl UNIT_LOOP1 // $AFEA0 83 7e 08 00 cmp bp+8, 0 //Spell_Anims 0f 84 .. .. jz $B02AC 90 90 90 90 nop x4 $AFF55: 9a 25 00 18 05 call GUI_Compose_CMB_BG() 9a 20 00 18 03 call GUI_DrawCombatScreen() 9a 03 05 08 00 call GUI_PageFlip_FX() 8b 3e 8e 99 mov di, 0x998e //LBX_Sandbox_Seg be 47 53 mov si, 0x5347 // "CMBTFX" 57 push di 6a 14 push 20 56 push si 9a 43 00 50 00 call LBXE_LoadAppend() 83 c4 06 add sp, 6 89 46 e4 mov bp-0x1c, ax //Confusion_Anim@ 57 push di 6a 03 push 3 68 17 5e push 0x5e17 // "SPECFX" 9a 43 00 50 00 call LBXE_LoadAppend() // :1F6A -> :1F64 83 c4 06 add sp, 6 89 46 e6 mov bp-0x1a, ax //Healing_Anim@ 57 push di 6a 02 push 2 68 17 5e push 0x5e17 // "SPECFX" 9a 43 00 50 00 call LBXE_LoadAppend() // :1F81 -> :1F75 83 c4 06 add sp, 6 89 46 e8 mov bp-0x18, ax //CChannel_Anim@ eb 0d jmp +13 90 57 push di 6a 01 push 1 56 push si 9a 43 00 50 00 call LBXE_LoadAppend() // :1F29 -> :1F87 83 c4 06 add sp, 6 89 46 ea mov bp-0x16, ax //WarpCr_Anim@ 57 push di 6a 00 push 0 // 0x21 to load FS 56 push si 9a 43 00 50 00 call LBXE_LoadAppend() // :1F9E -> :1F96 83 c4 06 add sp, 6 89 46 ec mov bp-0x14, ax //FireBolt_Anim@ 57 push di 6a 03 push 3 56 push si 9a 43 00 50 00 call LBXE_LoadAppend() // :1FD2 -> :1FA5 83 c4 06 add sp, 6 89 46 ee mov bp-0x12, ax //WarpL_Anim@ 57 push di 6a 05 push 5 56 push si 90 nop 9a 43 00 50 00 call LBXE_LoadAppend() 83 c4 06 add sp, 6 89 46 f0 mov bp-0x10, ax //DoomBolt_Anim@ 57 push di 6a 04 push 4 56 push si 9a 43 00 50 00 call LBXE_LoadAppend() // :1FE5 -> :1FC4 83 c4 06 add sp, 6 89 46 f2 mov bp-0x0e, ax //Disint_Anim@ eb .. jmp $B0046 $B0075: 9a 20 00 18 03 call GUI_DrawCombatScreen() 6a 73 push 0x73 // Call_Chaos ff 76 06 push bp+6 //Caster_ID 9a 5c 00 88 03 call GUI_DrawCmbtCastMsg() // :21FF -> :2062 59 pop cx 59 pop cx e9 .. .. jmp $B0160 UNIT_LOOP2: ($B0162) 8b c7 mov ax, di c1 e0 02 shl ax, 2 //sizeof(CALL_CHAOS) 8d b6 54 ff lea si, bp-0xac //Effect_Array 01 c6 add si, ax 80 3c 00 cmp byte ptr si, 0 //.Effect_Index 0f 8e .. .. jle $B0282 // jl in CoM $B017C: 6a 04 push 4 6a 04 push 4 8b c7 mov ax, di 6b c0 6e imul ax, 0x6e //sizeof(BU_REC) c4 1e 2a 92 les bx, 0x922a //BU_Table@ 03 d8 add bx, ax 26 ff 77 46 push word ptr es:bx+0x46 //.Y_Pos 26 ff 77 44 push word ptr es:bx+0x44 //.X_Pos 9a 52 00 d0 04 call CMB_GetScreenCoords() // :217F -> :2176 83 c4 0c add sp, 0x0c 8a 46 fe mov al, bp-2 //Current_Frame 3a 44 02 cmp al, si+2 //.First_Frame 0f 8c .. .. jl $B0282 3a 44 03 cmp al, si+3 //.Last_Frame 0f 8f .. .. jg $B0282 3a 44 01 cmp al, si+1 //.Apply_Frame 75 0c jnz +12 8a 04 mov al, si //.Effect_Index 98 cbw 50 push ax 57 push di 90 nop 0e push cs e8 .. .. call near $B02BC //BU_CallChaos() 59 pop cx 59 pop cx 8a 56 fe mov dl, bp-2 //Current_Frame 2a 54 02 sub dl, si+2 //.First_Frame 30 f6 xor dh, dh 8a 04 mov al, si //.Effect_Index 98 cbw 8d 76 e4 lea si, bp-0x1c //Effect_Anims[]@ 01 c6 add si, ax 01 c6 add si, ax 3c 06 cmp al, 6 // Doom Bolt 75 1a jnz +26 88 d3 mov bl, dl 80 fb 0c cmp bl, 12 7e 02 jle +2 b3 0c mov bl, 12 83 6e f6 0e sub bp-10, 14 //Draw_X f6 eb imul bl 05 9f ff add ax, -0x61 01 46 f4 add bp-12, ax //Draw_Y c1 ea 02 shr dx, 2 eb .. jmp DRAWANIM 3c 04 cmp al, 4 // Fire Bolt 7f 41 jg +65 // jge for FS 7c 31 jl +49 04 02 add al, 2 88 d3 mov bl, dl 90 x 7 nop x 7 f6 eb imul bl 05 aa ff add ax, -86 01 46 f4 add bp-12, ax //Draw_Y b0 f6 mov al, -10 f6 eb imul bl 83 c0 5e add ax, 94 89 46 f6 add bp-10, ax //Draw_X 80 fa 0a cmp dl, 10 74 0a jz +10 89 d0 mov ax, dx bb 03 00 mov bx, 3 99 cwd f7 fb idiv bx eb 21 jmp DRAWANIM ba 03 00 mov dx, 3 eb 1c jmp DRAWANIM 3c 01 cmp al, 1 7c 0a jl +10 83 6e f6 1c sub bp-10, 28 //Draw_X 83 6e f4 1e sub bp-12, 30 //Draw_Y eb 08 jmp +8 83 6e f6 0e sub bp-10, 14 //Draw_X 83 6e f4 1b sub bp-12, 27 //Draw_Y DRAWANIM: $B0240 52 push dx ff 34 push si 9a 0c 0c f0 00 call LBX_IMG_SetFrame() // :228F -> :2226 59 pop cx 59 pop cx ff 34 push si eb .. jmp $B0274 $B02AC: ff 36 8e 99 push 0x998e //LBX_Sandbox_Seg 9a 50 02 40 00 call LBX_Alloc_Undo() // :2294 -> :2293 59 pop cx $B02C3: 8b 76 06 mov si, bp+6 8b 5e 08 mov bx, bp+8 eb .. jmp $B0304 $B0426: 90 x 10 nop x 10 :1E7F -> :1E66 :1E84 -> :1E70 :1F24 -> :1EB2 :1F29 -> :1F87 :1F2E -> :206C :1F33 -> :206E :1F6A -> :1F64 :1F81 -> :1F75 :1F9E -> :1F96 :1FD2 -> :1FA5 :1FE5 -> :1FC4 :217F -> :2176 :21FF -> :2062 :228F -> :2226 :2294 -> :2293 :213B -> :2072 CoM Confusion supplement: $B0146: 85 c0 test ax, ax 75 12 jnz +12 8b c7 mov ax, di 6b c0 6e imul ax, 0x6e //sizeof(BU_REC) c4 1e 2a 92 les bx, 0x922a //BU_Table@ 03 d8 add bx, ax 26 83 4f 22 02 or es:bx+0x22, 2 // Confusion flag eb .. jmp $B01BD 50 push ax 57 push di eb .. jmp $B01B6 $B01B4: eb .. jmp $B0146 $B02B5: e9 .. .. jmp $AFFEE $AFFEE 59 pop cx 33 ff xor di, di 8b c7 mov ax, di c1 e0 02 shl ax, 2 //sizeof(CALL_CHAOS) 8d b6 54 ff lea si, bp-0xac //Effect_Array 01 c6 add si, ax 80 3c 00 cmp byte ptr si, 0 //.Effect_Index 75 0a jnz +10 6a 00 push 0 57 push di 90 nop 0e push cs e8 .. .. call near $B02BC //BU_CallChaos() 59 pop cx 59 pop cx 47 inc di 3b 3e 88 c5 cmp di, 0x88c5 //BU_Count 7c .. jl ... 5f pop di 5e pop si e9 .. .. jmp $B02B8 Category:Blog posts